1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%" height="17">
4         Nhà cung c&#
7845;p : <b> <a href="./?act=provider_m"><font color="#FFFFFF">Nh&#7853;p
5         M&#
7899;i</font></a><font color="#FFFFFF"> |</font></b></td>
6       </tr>
7     </table>
8 <?
9 $MAXPAGE=
20;
10
11     
switch ($_GET['action'])
12     {
13         
case 'del' :
14             $id = $_GET[
'id'];
15             $result = mysql_query(
"select products_id from products where providers_id='".$id."'",$con);
16             
if (mysql_num_rows($result)<=0) {
17                 $sql =
"delete from providers where providers_id='".$id."'";
18                 @$result = mysql_query($sql,$con);
19                 
if ($result) echo "<p align=center class='err'>&#272;ã xóa thành công</p>";
20                 
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
21             }
else {
22                 echo
"<p align=center class='err'>&#272;ang có s&#7843;n ph&#7849;m s&#7917; d&#7909;ng. nên b&#7841;n không th&#7875; xóa</p>";
23             }
24             
25             
break;
26     }
27 ?>
28
29 <?
30     
if (isset($_POST['ButDel'])) {
31         $cnt=
0;
32         
foreach ($_POST['chk'] as $id)
33         {
34             @$result = mysql_query(
"delete from providers where providers_id='".$id."'",$con);
35             
if ($result) $cnt++;
36         }
37         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
38     }
39 ?>
40 <?
41     $page = $_GET[
"page"];
42     $MAXPAGE=
10;
43     $p=
0;
44     
if ($page!='') $p=$page;
45 ?>
46 <form method=
"POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
47 <input type=
"hidden" name="act" value="provider">
48 <input type=hidden name=
"page" value="<? echo $page; ?>">
49 <?
50 function taotrang($sql,$link,$nitem,$itemcurrent)
51 {
global $con;
52     $ret=
"";
53     $result = mysql_query($sql, $con) or die(
'Error' . mysql_error());
54     $
value = mysql_fetch_array($result);
55     $plus = (($
value['cnt'] % $nitem)>0);
56     
for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
57     {
58         
if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
59         
else $ret .= ($i+1)." ";
60     }
61     
return $ret;
62 }
63     $pageindex=taotrang(
"select count(*) from providers","./?act=provider"."&page=",$MAXPAGE,$page);
64 ?>
65
66 <table cellspacing=
"0" cellpadding="0">
67 <tr>
68 <td
class="smallfont">Trang : <? echo $pageindex; ?></td>
69 </tr>
70 </table>
71
72 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
73   <tr>
74     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
75     <td nowrap
class="title">&nbsp;</td>
76     <td nowrap
class="title">&nbsp;</td>
77     <td align=
"center" nowrap class="title"><b>Mã</b></td>
78     <td align=
"center" nowrap class="title"><b>Tên nhà cung c&#7845;p</b></td>
79     <td align=
"center" nowrap class="title"><b>&#272;&#7883;a ch&#7881;</b></td>
80     <td align=
"center" nowrap class="title"><b>Hình</b></td>
81
82     <td align=
"center" nowrap class="title"><b>&#272;i&#7879;n tho&#7841;i</b></td>
83     <td align=
"center" nowrap class="title"><b>Email</b></td>
84     <td align=
"center" nowrap class="title"><b>Không hi&#7875;n th&#7883;</b></td>
85     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
86   </tr>
87   
88   <?
89                 $sql=
"select *,DATE_FORMAT(providers_dateadded,'%d/%m/%Y %h:%m') as dateformat from providers where providers_status=0 order by providers_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
90                 $result=mysql_query($sql,$con);
91                 $i=
0;
92                 
while(($row=mysql_fetch_array($result)))
93                 {
94                     $i++;
95                     
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
96   ?>
97   
98   <tr>
99     <td width=
"20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
100     <input type=
"checkbox" name="chk[]" value="<? echo $row['providers_id']; ?>"></td>
101     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
102     <a href=
"./?act=provider_m&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['providers_id']; ?>">
103     S&#
7917;a</a></td>
104     <td width=
"20" bgcolor="<? echo $color; ?>" class="smallfont">
105     <a href=
"./?act=provider&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['providers_id']; ?>">
106     Xoá</a></td>
107     <td width=
"20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['providers_id']; ?>&nbsp;</td>
108     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['providers_name']; ?>&nbsp;</td>
109     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['providers_address']; ?>&nbsp;</td>
110     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['providers_image']; ?>&nbsp;</td>
111     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['providers_phone']; ?>&nbsp;</td>
112     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['providers_email']; ?>&nbsp;</td>
113     <td width=
"80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['providers_status']; ?>&nbsp;</td>
114     <td width=
"100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?>&nbsp;</td>
115   </tr>
116   <?
117                 }
118   ?>
119 </table>
120 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button" style="padding: 0">
121 </form>
122 <script language=
"JavaScript">
123 function chkallClick(o) {
124     
var form = document.frmList;
125     
for (var i = 0; i < form.elements.length; i++) {
126         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
127             form.elements[i].
checked = document.frmList.chkall.checked;
128         }
129     }
130 }
131 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.895 lượt xem

Gõ tìm kiếm nhanh...